package com.example.avue.controller;

import com.example.avue.entity.VisualCategory;
import com.example.avue.service.VisualCategoryService;
import com.example.avue.util.ResResponse;
import com.example.avue.util.ResResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/category")
public class VisualCategoryController {
    @Autowired
    VisualCategoryService visualCategoryService;

    @GetMapping("/hello")
    public String hello(){
        return "index";
    }
    /**
     * 打开首页获取分组列表
     * @return
     */
    @RequestMapping("/list")
    public ResResult<List<VisualCategory>> list(){
        List<VisualCategory> list = visualCategoryService.getList();
        return ResResponse.makeOKRsp(list);
    }


}
